﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Styx.Common;

namespace MIBPriest
{
    public partial class MIB_SettingsForm : Form
    {
        public MIB_SettingsForm()
        {
            InitializeComponent();
        }

        private void DesperatePrayer_ValueChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.DesperatePrayer = (int)DesperatePrayer.Value;
        }

        private void DispersionMana_ValueChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.DispersionMana = (int)DispersionMana.Value;
        }

        private void DispersionHP_ValueChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.DispersionHP = (int)DispersionHP.Value;
        }

        private void HaloMin_ValueChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.HaloMin = (int)HaloMin.Value;
        }

        private void HaloMax_ValueChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.HaloMax = (int)HaloMax.Value;
        }

        private void HaloSafeCheck_CheckedChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.HaloSafeCheck = HaloSafeCheck.Checked;
        }

        private void HealthstonePercent_ValueChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.HealthstonePercent = (int)HealthstonePercent.Value;
        }

        private void MindFlayDuration_ValueChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.MindFlayDuration = (int)MindFlayDuration.Value;
        }

        private void MindSearClipping_ValueChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.MindSearClipping = (int)MindSearClipping.Value;
        }

        private void MindSearStartonUnit_ValueChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.MindSearStartonUnit = (int)MindSearStartonUnit.Value;
        }

        private void SWPRefresh_ValueChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.SWPRefresh = (int)SWPRefresh.Value;
        }

        private void VampiricEmbracePercent_ValueChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.VampiricEmbracePercent = (int)VampiricEmbracePercent.Value;
        }

        private void VampiricTouchRefresh_ValueChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.VampiricTouchRefresh = (int)VampiricTouchRefresh.Value;
        }

        private void FaceAuto_CheckedChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.FaceAuto = FaceAuto.Checked;
        }

        private void FadeAuto_CheckedChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.FadeAuto = FadeAuto.Checked;
        }

        private void InnerFire_CheckedChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.InnerFire = InnerFire.Checked;
        }

        private void PowerWordFortitude_CheckedChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.PowerWordFortitude = PowerWordFortitude.Checked;
        }

        private void PowerWordShield_CheckedChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.PowerWordShield = PowerWordShield.Checked;
        }

        private void ShadowfiendAuto_CheckedChanged(object sender, EventArgs e)
        {
            MIBSettings.Instance.ShadowfiendAuto = ShadowfiendAuto.Checked;
        }

        private void SPauseKey_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void SAoEKey_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void SHaloKey_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void SModeKey_SelectedIndexChanged(object sender, EventArgs e)
        {

        }


        private void MIBSettingForm_Load(object sender, EventArgs e)
        {
            //Grafiken laden
            if (File.Exists(Utilities.AssemblyDirectory + @"\Routines\MIBPriest\MIBPriest.jpg"))
            {
                pictureBoxPriest.ImageLocation = Utilities.AssemblyDirectory + @"\Routines\MIBPriest\MIBPriest.jpg";
            }
            if (File.Exists(Utilities.AssemblyDirectory + @"\Routines\MIBPriest\MIBPriestShadow.jpg"))
            {
                pictureBoxShadow.ImageLocation = Utilities.AssemblyDirectory + @"\Routines\MIBPriest\MIBPriestShadow.jpg";
            }
            if (File.Exists(Utilities.AssemblyDirectory + @"\Routines\MIBPriest\MIBPriestDiszi.jpg"))
            {
                pictureBoxDiszi.ImageLocation = Utilities.AssemblyDirectory + @"\Routines\MIBPriest\MIBPriestDiszi.jpg";
            }
            if (File.Exists(Utilities.AssemblyDirectory + @"\Routines\MIBPriest\MIBPriestHoly.jpg"))
            {
                pictureBoxHoly.ImageLocation = Utilities.AssemblyDirectory + @"\Routines\MIBPriest\MIBPriestHoly.jpg";
            }

            DesperatePrayer.Value = MIBSettings.Instance.DesperatePrayer;
            DispersionMana.Value = MIBSettings.Instance.DispersionMana;
            DispersionHP.Value = MIBSettings.Instance.DispersionHP;
            HaloMin.Value = MIBSettings.Instance.HaloMin;
            HaloMax.Value = MIBSettings.Instance.HaloMax;
            HaloSafeCheck.Checked = MIBSettings.Instance.HaloSafeCheck;
            HealthstonePercent.Value = MIBSettings.Instance.HealthstonePercent;
            MindFlayDuration.Value = MIBSettings.Instance.MindFlayDuration;
            MindSearClipping.Value = MIBSettings.Instance.MindSearClipping;
            MindSearStartonUnit.Value = MIBSettings.Instance.MindSearStartonUnit;
            SWPRefresh.Value = MIBSettings.Instance.SWPRefresh;
            VampiricEmbracePercent.Value = MIBSettings.Instance.VampiricEmbracePercent;
            VampiricTouchRefresh.Value = MIBSettings.Instance.VampiricTouchRefresh;
            FaceAuto.Checked = MIBSettings.Instance.FaceAuto;
            FadeAuto.Checked = MIBSettings.Instance.FadeAuto;
            InnerFire.Checked = MIBSettings.Instance.InnerFire;
            PowerWordFortitude.Checked = MIBSettings.Instance.PowerWordFortitude;
            PowerWordShield.Checked = MIBSettings.Instance.PowerWordShield;
            ShadowfiendAuto.Checked = MIBSettings.Instance.ShadowfiendAuto;
            Shadowform.Checked = MIBSettings.Instance.Shadowform;
            ManaSWP.Value = MIBSettings.Instance.ManaSWP;
            SAoEKey.SelectedIndex = MIBSettings.Instance.SAOEKey;
            SPauseKey.SelectedIndex = MIBSettings.Instance.SPauseKey;
            SHaloKey.SelectedIndex = MIBSettings.Instance.SHaloKey;
            SModeKey.SelectedIndex = MIBSettings.Instance.SModeKey;
        }

        private void bDefault_Click(object sender, EventArgs e)
        {
            DesperatePrayer.Value = 30;
            DispersionMana.Value = 10;
            DispersionHP.Value = 20;
            HaloMin.Value = 22;
            HaloMax.Value = 28;
            HaloSafeCheck.Checked = true;
            HealthstonePercent.Value = 20;
            MindFlayDuration.Value = 2000;
            MindSearClipping.Value = 1000;
            MindSearStartonUnit.Value = 6;
            SWPRefresh.Value = 3000;
            VampiricEmbracePercent.Value = 70;
            VampiricTouchRefresh.Value = 3000;
            FaceAuto.Checked = true;
            FadeAuto.Checked = true;
            InnerFire.Checked = true;
            PowerWordFortitude.Checked = true;
            PowerWordShield.Checked = true;
            ShadowfiendAuto.Checked = true;
            Shadowform.Checked = true;
            ManaSWP.Value = 60;
            SAoEKey.SelectedIndex = 1;
            SPauseKey.SelectedIndex = 16;
            SHaloKey.SelectedIndex = 8;
            SModeKey.SelectedIndex = 18;
        }

        private void bCancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void bOK_Click_1(object sender, EventArgs e)
        {
            MIBSettings.Instance.Save();
            Logging.Write("----------------------------------");
            Logging.Write("MIBPriest Settings wurden gespeichert");
            Close();
        }
    }
}
